<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>    
    //#region
        var person={
            name:"张三",
            age:12
        }
        // Object.defineProperty(person,"name",{
        //     getter(){
        //         console.log("读取值");
        //     },
        //     setter(){
        //         console.log("修改值");
        //     }
        // })
    //#region
        // try{
        //     console.log(a);
        // }catch{
        //     console.log("错误了");
        // }

        const p=new Proxy(person,{

            get(target,propName){
                console.log(`读取了${propName}属性`);
                return target[propName]
            },
            set(target,propName){

            }
        })
    </script>
</body>
</html>